package com.three.box.activity

import android.content.Intent
import android.os.Bundle
import com.tencent.mmkv.MMKV
import com.three.box.MainActivity
import com.three.box.base.BaseActivity
import com.three.box.config.Constant
import com.three.box.databinding.ActivityEntryBinding

class EntryActivity : BaseActivity() {

    companion object {
        private const val TAG = "EntryActivity"
    }

    private lateinit var binding: ActivityEntryBinding

    override fun onCreate(savedInstanceState: Bundle?) {
        binding = ActivityEntryBinding.inflate(layoutInflater)
        setStatusBar()
        super.onCreate(savedInstanceState)

        init()
    }

    override fun getLayoutView() = binding.root

    private fun init() {
        val mmkv = MMKV.defaultMMKV()
        val token = mmkv.decodeString(Constant.TOKEN)
        if (token.isNullOrEmpty()) {
            startActivity(Intent(this, LoginActivity::class.java))
        } else {
            startActivity(Intent(this, MainActivity::class.java))
        }
    }

}


















